
#include <vector>
#include <map>
using namespace std;
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        vector<int>res;
        map<int,int> resset;
        for(int i=0;i!=nums.size();++i){
                if(resset.find(target-nums[i]) != resset.end()){
                        res.push_back(resset[target-nums[i]]);
                        res.push_back(i);
                        break;
                }   
                resset.insert(make_pair(nums[i],i));
        }
        return res;
    }
};

struct ListNode {
	int val;
	struct ListNode *next;
};

struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {
    short carry=0; /*进位*/
    struct ListNode *npt,*opt,*temp;

    temp=(struct ListNode *)malloc(sizeof(struct ListNode));
    temp->next=NULL;
    npt=temp;
    opt=temp;

    while(!(l1 == NULL && l2 == NULL)){
        npt=(struct ListNode *)malloc(sizeof(struct ListNode));
        npt->next=NULL;
        int temp1 = ((l1 == NULL) ? 0 : (l1->val));
        int temp2 = ((l2 == NULL) ? 0 : (l2->val));
        npt->val=(( temp1 + temp2 + carry)%10);
        carry=((temp1 + temp2 + carry)-(( temp1 + temp2 + carry)%10))/10;


        opt->next=npt;
        opt=npt;

        l1=(l1 == NULL) ? NULL : l1->next;
        l2=(l2 == NULL) ? NULL : l2->next;

    }

    if(carry != 0){
        npt=(struct ListNode *)malloc(sizeof(struct ListNode));
        npt->next=NULL;
        opt->next=npt;
        npt->val=carry;
    }
    return temp->next;
}



int main(int argc, char *argv[])
{
	
	return 0;
}
